// 导入需要的config和request
import confing from '../config/config.js';
import request from '../util/request.js';
// 申明请求对象
const shiftRequest = {
  // dict请求的基本url
  BASE_URL: confing.CAL_URL + "/shift",

    //删除班次信息
  deletes(shiftIds,callback){
    // 拼接URL
    let url = this.BASE_URL + "/deletes?t=1";
    if(shiftIds != undefined){
        shiftIds.forEach(shiftId => {
            url += "&shiftIds=" + shiftId;
        });
        request.delete(url,callback);
    }
  },
   // 更改班次数据
   update(calShift,callback){
    let url = this.BASE_URL + "/update";
    request.put(url,calShift,callback);
  },
  //根据Id查询班次信息
  get(shiftId,callback){
    let url = this.BASE_URL + "/get?shiftId=" + shiftId;
    // 发送请求
    request.get(url,callback);
  },
  //添加班次数据
  save(calShift,callback){
    let url = this.BASE_URL + "/save";
    request.post(url,calShift,callback);
},
  // 分页查询
  list(planId, callbcak) {
    // url
    let url = this.BASE_URL + "/list?planId=" + planId;
    // 发送请求
    request.get(url, callbcak);
  }
}
// 将dictRequest暴漏出去
export default shiftRequest;